package com.yugu.park.redis;

import javax.annotation.Resource;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.stereotype.Component;

import com.yugu.park.dto.DriverDto;
@Component
public class RedisUtil {
	@Resource
	private RedisTemplate<String, Object> redisTemplate;
	public void setDriverToRedis(String key, DriverDto t) {
		redisTemplate.setHashValueSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
		redisTemplate.opsForHash().put(key, "driverId", t.getDriverId());
		redisTemplate.opsForHash().put(key, "driverName", t.getDriverName());
		redisTemplate.opsForHash().put(key, "mobile", t.getMobile());
		redisTemplate.opsForHash().put(key, "jobNumber", t.getJobNumber());
		redisTemplate.opsForHash().put(key, "workFlag", t.getWorkFlag());
		redisTemplate.opsForHash().put(key, "sex", t.getSex());
		redisTemplate.opsForHash().put(key, "longitude", t.getLongitude());
		redisTemplate.opsForHash().put(key, "latitude", t.getLatitude());
		redisTemplate.opsForHash().put(key, "franchiseeId", t.getFranchiseeId());
	}

}
